package com.cat.controller;

import com.cat.pojo.Carlist;
import com.cat.service.CarService;
import com.cat.util.LayUI;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class CarController {
    @Resource
    private CarService carService;

    @GetMapping("/getAllCar")
    @ResponseBody
    public LayUI getallcar(){

        LayUI lu=new LayUI();

        lu.setCode(0);
        lu.setMsg("");
        lu.setData(carService.getAllCar());

        return lu;

    }
    @GetMapping("/getCarByCid/{id}")
    @ResponseBody
    public Carlist getCarById(@PathVariable("id") int id){
        System.out.println(id);
       return carService.getCarById(id);

    }
}
